/*
 * @Author: EltonLi lijiaming@uavi-tech.com
 * @Date: 2024-03-12 09:51:23
 * @LastEditors: LVGRAPE
 * @LastEditTime: 2025-04-29 14:35:25
 * @FilePath: \zino-fc-v4\applications\ZINO_FC_V4.0\program\program.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#ifndef __PROGRAM_H__
#define __PROGRAM_H__

#ifdef __cplusplus
extern "C"
{
#endif

#include <stdbool.h>
#include "rtthread.h"
enum
{

    PRO_EVENT_START = 0x01,
    PRO_EVENT_STOP = 0x02,
    PRO_EVENT_FORWARD = 0x04,
    PRO_EVENT_BACKWARD = 0x08,
    PRO_EVENT_LEFT = 0x10,
    PRO_EVENT_RIGHT = 0x20,
    PRO_EVENT_UP = 0x40,
    PRO_EVENT_DOWN = 0x80,
    PRO_EVENT_ROTATE = 0x100,
    PRO_EVENT_FLIP = 0x200,
    PRO_EVENT_LAND = 0x400,
    PRO_EVENT_TAKEOFF = 0x800,
    PRO_EVENT_AIRBORNE = 0x1000,
    PRO_EVENT_LANDED = 0x2000,
    PRO_EVENT_ENABLE = 0x4000,
    PRO_EVENT_DISABLE = 0x8000,
    PRO_EVNET_RT_TRIGGER = 0x10000,
    PRO_EVNET_LT_TRIGGER = 0x20000,
    PRO_EVENT_FLIP_DONE  = 0x40000,

    PRO_EVENT_ALL = 0xFFFFFFFF,
};
enum{
    MIXLY_RC_RLR=1,
    MIXLY_RC_RUD,
    MIXLY_RC_LLR,
    MIXLY_RC_LUD,
    MIXLY_RC_LT,
    MIXLY_RC_RT,
};

// void drone_run_program_takingoff(void);
// void drone_run_program_landing(void);
// void drone_run_program(int16_t throttle, int16_t roll, int16_t pitch, int16_t yaw);
// void drone_run_program_throttle(int16_t throttle);
// void drone_run_program_roll(int16_t roll);
// void drone_run_program_pitch(int16_t pitch);
// void drone_run_program_yaw(int16_t yaw);
int16_t get_rc_data(uint8_t ch);
void set_rgb_color(uint8_t num, uint8_t r, uint8_t g, uint8_t b);
void set_all_rgb_color(uint8_t r, uint8_t g, uint8_t b);
void reset_rgb_color(uint8_t num, uint8_t r, uint8_t g, uint8_t b);
void set_motor_speed(uint8_t num, int16_t speed);
void set_motor_speed_all(int16_t speed);
void reset_all_motor();

void set_rgb_auto(uint8_t *rgbBuffer, uint16_t count);
// extern uint32_t pro_event_state;
extern rt_event_t pro_event;


void pro_event_state_set(uint32_t eventstate);
void pro_event_state_reset(uint32_t eventstate);
bool check_pro_event_enable();
void pro_event_send(uint32_t event);
void pro_event_send_enable();
void pro_event_start();
void pro_drone_ctrl(int16_t pitch, int16_t roll, int16_t throttle, int16_t yaw);
void pro_drone_takeoff();
void pro_drone_land();
void pro_drone_stop();
void pro_event_reset_all();
void pro_disable_fc();
void pro_enable_fc();
bool get_fc_main_state();
void set_rgb_mode(uint8_t r1, uint8_t g1, uint8_t b1, uint8_t m1, uint8_t r2, uint8_t g2, uint8_t b2, uint8_t m2);
void pro_drone_unlock(int input);
void pro_drone_headmode(int input);
void pro_drone_baroMode(int input);
void pro_drone_flipMode(int input);
// void pro_drone_pitch_angle(int input);
// void pro_drone_roll_angle(int input);
// void pro_drone_yaw_rate(int input);
int is_rc_key_down(int input);
int ge_rc_value(int input);
void fc_flip_ctrl(int direction);
#define delay rt_thread_mdelay
extern bool pro_autotakingoff;
extern bool pro_autolanding;

#ifdef __cplusplus
}
#endif

#endif /* ZINO_IMU_IMU_H_ */
